#ifdef TARG_SW5
cc = sw5cc.old -host -O3 
cc_slave = sw5cc.old  -O3
#endif

#ifdef TARG_SW3
cc = swcc -O3 #-OPT: unroll_times_max=1 #-msimd 
cc_slave = sw3cc -O3 #-OPT: unroll_times_max=1# -msimd
#endif

SCHEDULER_INSTALL_PATH=${DAG_HOME}/dag_task_scheduler

#the macro for main memory code 
main_mem = -D__MAIN_MEM


EXTRA_FLAGS= -DCHECK -DSIZEX=226 -DSIZEY=450 -DSIZEZ=34 -DBLKX=7 -DBLKY=7 -DBLKZ=16
CFLAGS = $(EXTRA_FLAGS)  -I${SCHEDULER_INSTALL_PATH}/include -L${SCHEDULER_INSTALL_PATH}/lib

LIBFLAGS =  -ldag_task_scheduler -lstdc++ -lm #-I/usr/sz/swcc/sw3gcc-binary/include

OBJECT_REUSE = 3d7p_master.o 3d7p_reuse_27.o
OBJECT_REFOLLOW = 3d7p_master_follow.o 3d7p_reuse_27.o
OBJECT_NAIIVE = 3d7p_master.o 3d7p_naiive_dag.o

reuse: 3d7p_master.o 3d7p_reuse_27.o   3d7p_reuse_27 
naiive: 3d7p_master.o 3d7p_naiive_dag.o 3d7p_naiive
follow: 3d7p_master_follow.o 3d7p_reuse_27.o   3d7p_re_follow

3d7p_master.o: 3d7p_master.c
	$(cc) $(CFLAGS) -c  3d7p_master.c  $(LIBFLAGS)
3d7p_master_follow.o: 3d7p_master_follow.c
	$(cc) $(CFLAGS) -c  3d7p_master_follow.c  $(LIBFLAGS)

3d7p_naiive_dag.o:  3d7p_naiive_dag.c
	$(cc_slave) $(CFLAGS)  -c 3d7p_naiive_dag.c  $(LIBFLAGS)  -D__STRIDE_DMA #-SPLIT_3D
3d7p_reuse_27.o:   3d7p_reuse_27.c
	$(cc_slave) $(CFLAGS) -c 3d7p_reuse_27.c  $(LIBFLAGS) #-DNOSTRIDE

3d7p_reuse_27:   $(OBJECT_REUSE)
	$(cc_slave) -hybrid $(CFLAGS)  -o 3d7p_reuse_27 $(OBJECT_REUSE) $(LIBFLAGS) #-DNOSTRIDE
3d7p_re_follow:   $(OBJECT_REFOLLOW)
	$(cc_slave) -hybrid $(CFLAGS)  -o 3d7p_re_follow $(OBJECT_REFOLLOW) $(LIBFLAGS) #-DNOSTRIDE
3d7p_naiive:  $(OBJECT_NAIIVE) 
	$(cc_slave) -hybrid   $(CFLAGS)  -o 3d7p_naiive $(OBJECT_NAIIVE) $(LIBFLAGS) -D__STRIDE_DMA #-SPLIT_3D
3d7p_reuse1: 3d7p_master.o 3d7p_reuse_27.c
	$(cc_slave) $(CFLAGS) -c 3d7p_reuse_27.c  $(LIBFLAGS)
	$(cc_slave) -hybrid $(CFLAGS)  -o 3d7p_reuse1  3d7p_master.o 3d7p_reuse_27.o $(LIBFLAGS)
clean:
	@-rm -f *.o 3d7p_reuse_27 3d7p_naiive 3d7p_re_follow  
